package com.wtcrazy.controller;

import com.wtcrazy.entity.Order;
import com.wtcrazy.service.Impl.OrderServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderServiceImpl orderService;

    @ApiOperation("【拦截】用户提交订单")
    @PostMapping("/userSubmit")//
    public Order userSubmit(@RequestBody Order order) {
        return orderService.userSubmit(order);
    }
    @ApiOperation("【拦截】用户获得自己的订单")
    @GetMapping("/userGetAll")//
    public List<Order> userGetAll(@RequestParam String uid) {
        return orderService.userGetAll(uid);
    }
    @ApiOperation("【拦截】得到用户的具体某个订单")
    @GetMapping("/userGet")//
    public Order userGet(@RequestParam String id) {
        Order dbOrder = orderService.userGet(id);
        return dbOrder;
    }
}
